package nsoft.swing.window;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;

public class StatuBar extends JPanel {
	/**
	 * serialVersionUID = 1L.
	 */
	private static final long serialVersionUID = 1L;
	private JLabel title;
	private JLabel message;
	private JProgressBar status;

	public StatuBar() {
		setLayout(new BorderLayout());
		title = new JLabel("fdsfsd");
		title.setBorder(BorderFactory.createLoweredBevelBorder());
		message = new JLabel("");
		message.setBorder(BorderFactory.createLoweredBevelBorder());
		status = new JProgressBar(0, 100);
		title.setMinimumSize(new Dimension(100, 20));
		status.setMinimumSize(new Dimension(50, 20));
		status.setBorder(BorderFactory.createLoweredBevelBorder());
		add(title, BorderLayout.WEST);
		add(message, BorderLayout.CENTER);
		add(status, BorderLayout.EAST);
	}

	public void setTitle(String title) {
		this.title.setText(title);
		this.title.repaint();
	}

	public void setMessage(String message) {
		this.message.setText(message);
		this.message.repaint();
	}

	public void setStatu(int statu) {
		if (statu > 100) {
			statu = 100;
		}
		this.status.setValue(statu);
		this.status.repaint();
	}

}
